Skip to content

fix(ci): release checks refuse a patch release that carries a breaking change - #8392

Merged
miguel-heygen merged 3 commits into
mainfrom
secbounds/release-check-breaking-bump
Nov 21, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
secbounds/release-check-breaking-bump

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

What

scripts/ci/release-only-diff.mjs --verify now fails a release that is too small a bump for a breaking change it carries.

A breaking change is any commit since the last release whose subject has the conventional ! (fix(cli)!: …). Below 1.0 such a commit needs the next minor (0.9.x → 0.10.0); from 1.0 on, the next major. Each release's old version comes from the manifests the release bumps. If those manifests start from different versions, the check refuses that too.

A breaking change that a later commit reverts doesn't count. A commit is reverted when a later commit in effect says This reverts commit <sha>, the line git revert writes and GitHub keeps in a squash body. A revert of that revert brings the breaking change back. Only the subject's ! is read; this repo doesn't use BREAKING CHANGE: footers on their own.

The error names the commit and the version to use:

v0.9.78 is too small a bump for a breaking change: 296031974 fix(cli)!: … (#8311). Release it as v0.10.0, or revert the change first.

Why

The publish workflow releases from main. So a breaking change that merges while a patch release is open ships in that patch, and nothing checked for it. That happened today: #8311 raised the CLI's Node floor and merged while the v0.9.78 release PR was open.

The existing notes check catches this only by accident, when the notes don't happen to list the commit. A redraft that lists it would have passed.

Checks

fails without the fix: scripts/ci/release-only-diff.test.mjs "--verify refuses a patch release that carries a breaking change".

All on the devbox:

  • Red-first: against main's script, the refusal test fails.
  • The real case: I merged the v0.9.78 release branch onto current main, which holds fix(cli)!: a proxy that drops the connection fails a request once instead of retrying nonstop #8311, the way the merge queue does. This branch's check names fix(cli)!: a proxy that drops the connection fails a request once instead of retrying nonstop #8311 and says to release v0.10.0. Main's check reports only the missing notes.
  • The fix works end to end: I squash-merged the revert PR onto main first, the way GitHub would, then merged v0.9.78 on top. The breaking check passes, and only the missing-notes check is left.
  • New tests: a reverted breaking change passes a patch release. A revert of the revert refuses it again. Manifests that start from different versions are refused. Against the first head's script, the revert test and the mixed-versions test fail.
  • Breaking releases still pass: a breaking change released as the next minor passes.
  • Tests: the file passes 19/19, three runs in a row.

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at fcd2e79, for one dead end. The check itself is right: BREAKING_SUBJECT, next minor below 1.0 and next major from 1.0, allowsBreaking's compare, and the old version taken from the bumped manifests.

"Revert the change first" doesn't clear the check. commitsSinceLastRelease is git log --no-merges <last>..<base>, so after a revert both commits are in commits. The revert's subject is Revert "fix(cli)!: needs Node 22 (#2)", which BREAKING_SUBJECT doesn't match, but verifyRelease still finds the original fix(cli)!: commit and refuses. So the error's own remedy can't pass, and it's the live case right now: if #8311 is reverted to ship v0.9.78 as a patch, --verify still says to release v0.10.0.

Fix: drop breaking commits that a later commit in the range reverts. Matching the subject is enough here, Revert "<subject>", or read This reverts commit <sha> from the body if you'd rather key on the sha. One test covers it: repoWithBreakingChange("0.8.2") plus a Revert "fix(cli)!: needs Node 22 (#2)" commit should pass --verify.

Nits:

  • from = [...previous][0] takes whichever manifest came first. If two manifests had different old versions, the check would silently use one. verifyRelease already refuses mismatched new versions, so a matching guard on previous.size > 1 would be consistent.
  • Only the subject ! counts. A BREAKING CHANGE: footer without ! slips through. That's fine if the repo only uses !, but worth one line in the docstring.

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at e132e09, for the quality gate only. The code is right: inEffect closes the revert dead end, and the mismatched-versions guard is in.

Fallow audit fails because of this PR: fallow/high-crap-score at scripts/ci/release-only-diff.mjs:88, "'verifyRelease' has CRAP score 49.5 (threshold: 30.0, cyclomatic 13)". The new breaking-change and previous branches pushed verifyRelease over. Splitting the breaking check into its own function would bring it back under. Something like breakingProblem({ previous, version }, commits), returning the message or null, holding the previous.size > 1 guard, inEffect(...).find(...) and allowsBreaking. verifyRelease would then push what it returns. The existing tests cover it unchanged.

Studio and player captures was cancelled at "Require Before and After captures". This PR has no UI, so if that check is required here, it needs the no-UI path.

The approval follows a green run.

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 1bda4c6. This clears my changes-requested (the Fallow gate: 1bda4c6 splits verifyRelease into breakingBumpProblems, notesProblems and changelogProblems, with the same checks in the same order).

  • The revert now clears the check. inEffect walks the commits newest first. A commit still in effect that says This reverts commit <sha> takes out the one it names, and a commit already taken out is never scanned. So a revert clears the breaking commit, and a revert of the revert brings it back. Both are tested.
  • It matches how this repo merges. Squash merges keep the commit messages (squash_merge_commit_message: COMMIT_MESSAGES), so git revert's line survives into main. Two of the last three reverts on main carry it (#8174, #7978).
  • Mismatched old versions now refuse ("manifests move from different versions"), with a test. commitsSinceLastRelease splits records on \x1e/\x1f, so a body holding tabs or newlines can't break the parse.

Nit: a hand-written undo that says it in prose ("Reverts the … (#7265)", as #7383 did) won't count. The error's "revert the change first" could say "with git revert".

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. The check now refuses a release that is too small a bump for a breaking change it carries, and it matches the PR description.

Need ✅ (#8311 nearly shipped in a patch) · Size ✅ (+89/−37 plus tests) · Reuse ✅ (extends the existing --verify path and commit walk) · Simpler ✅ (split into one function per check) · Structure ✅
Risk: low. This is a CI-only script, and on doubt it refuses the release, which fails closed.

What I checked at 1bda4c6

  • versionBump now returns { from, to }, and classify collects the starting versions. verifyRelease refuses manifests that start from different versions before it runs the breaking check, so from always has a single value.
  • In inEffect, the newest commits come first, and a commit that is in effect removes the commits it names as reverted. A reverted revert is skipped, so its body is never read, which correctly puts the original change back. The commit walk now uses \x1f/\x1e separators, so multi-line bodies parse.
  • I probed verifyRelease directly:
case result
0.9.78 → 0.9.79 with a ! change refuses
→ 0.10.0 passes
→ 1.0.0 passes
→ 0.10.0-rc.1 passes
1.2.3 → 1.3.0 refuses
1.2.3 → 2.0.0 passes
! change reverted (This reverts commit <sha>) passes
revert of that revert refuses
a Revert "feat!: …" subject not counted as breaking
  • Against real history: the revert commit for #8311 on main (66156bf) carries This reverts commit 2960319749, and that prefix matches the #8311 commit. node --test scripts/ci/release-only-diff.test.mjs passes 19/19. CI is green.

Nit (non-blocking)

  • A few reverts here are written as Reverts #NNNN with no sha (a3ff1c4, 4d9a4e4). That form is not recognized, so a breaking change reverted that way still refuses a patch release. It fails closed, and since June 15 reverts use the sha line against 2 that use the PR form. Still, a one-line hint in the error ("the revert must say This reverts commit <sha>") would save someone the debugging.

— Rames (hf-review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit e87babf Nov 21, 2026
68 checks passed
@miguel-heygen
miguel-heygen deleted the secbounds/release-check-breaking-bump branch November 21, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants